package com.viknix.threadpool.manager.example.rejected;

import com.viknix.threadpool.manager.client.spi.CustomRejectedHandler;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author: Dongqi
 * @Date: 2021/11/7 19:06
 * @Version 1.0
 * @Description: 示例拒绝策略
 */
public class ExampleCustomRejectedHandler implements CustomRejectedHandler {

    @Override
    public Integer getCode() {
        return 10;
    }

    @Override
    public String getName() {
        return "ExampleCustomRejectedHandler";
    }

    @Override
    public RejectedExecutionHandler generateRejected() {
        return new ThreadPoolExecutor.AbortPolicy();
    }
}
